// This module is licensed and may be used under the terms of the
//  GPL, GNU General Public License, V3 or later, http://www.gnu.org/licenses/gpl.html
//
// Please contact the author if you need another license.
// This module is provided "as is", without warranties of any kind.

import java.util.*;

/**
 * Container class to encapsulate an email message
 * 
 * Project home page: http://code.google.com/p/simple-net-comm/
 * Author: Jonathan Bonazza
 * License: GPL
 */
public class EmailMessage
{
	private String from;		//The source address
	private String replyTo;		//The reply-to address
	private String bcc;		//The BCC for the message
	private String cc;		//The CC for the message
	private String to;		//The destination address
	private String inReplyTo;	//The previous correspondence which this message answers
	private String references;	//The other correspondence which this message references
	private String keywords;	//Keywords or phrases seperated by commas
	private Strinc comments;	//Text comments on the message, not a part of the body
	private Date date;		//The date the message was sent
	private String subject;		//The message subject
	private String body;		//The message body
	private String uidl;		//The message UIDL
	private int msgIdx;		//The index of the message in the user's mailbox

	public EmailMessage(String from, String replyTo, String bcc, String cc, String to, String inReplyTo, String references,
				 String keywords, String comments, Date date, String subj, String body, int msgIdx)
	{
		this.from = from;
		this.replyTo = replyTo;
		this.bcc = bcc;
		this.cc = cc;
		this.to = to;
		this.inReplyTo = inReplyTo;
		this.references = references;
		this.keywords = keywords;
		this.comments = comments;
		this.date = date;
		this.subject = subj;
		this.body = body;
		this.uidl = null;
		this.msgIdx = msgIdx;
	}

	//Accessor methods
	public String getFrom() { return from; }
	public String getReplyTo() { return replyTo; }
	public String getBCC() { return bcc; }
	public String getCC() { return cc; }
	public String getTo() { return to; }
	public String getInReplyTo() { return inReplyTo; }
	public String getReferences() { return references; }
	public String getKeywords() { return keywords; }
	public String getComments() { return comments; }
	public Date getDate() { return date; }
	public String getSubject() { return subject; }
	public String getBody() { return body; }
	public String getUIDL() { return uidl; }
	public int getMessageIndex() { return msgIdx; }

	//Mutator method
	public void setUIDL(String uidl) { this.uidl = uidl; }

	//overridden toString()
	public String toString()
	{
		return "From: " + from +
				"\nTo: " + to +
				"\nDate: " + date +
				"\nSubject: " + subject +
				"\n" + body + "\n";
	}
}
